﻿<form action="" method="post" class="layui-form layui-form-pane">
    <div class="layui-form-item">
        <label for="roleName" class="layui-form-label">
            角色名称
        </label>
        <div class="layui-input-block">
            <input type="text" id="roleName" name="roleName"
                   lay-verify="required" lay-vertype="tips"
                   autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="remark" class="layui-form-label">
            角色描述
        </label>
        <div class="layui-input-block">
            <input type="text" id="remark" name="remark"
                   lay-verify="required" lay-vertype="tips"
                   autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block" style="margin-left:0;text-align:center;">
            <input type="hidden" name="roleId">
            <button class="layui-btn layui-btn-normal" type="button" lay-submit="" lay-filter="add">添加</button>
            <button class="layui-btn" type="button" lay-submit="" lay-filter="close">关闭</button>
        </div>
    </div>
</form>
@section script{
    <script>
        layui.use(['form', 'layer'], function (form,layer) {
            // 监听提交
            form.on('submit(add)', function () {
                layer.msg("添加成功", {icon: 6},function(){
                    var index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe 层的索引
                    parent.layer.close(index); // 再执行关闭
                });
               
                return false;
            });

        });
    </script>
}